package org.gw.ylc.base.repositories;

import org.gw.ylc.base.model.Department;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.CrudRepository;

import java.util.List;

public interface DepartmentRepository extends CrudRepository<Department, String> {
	@Query("from Department d where (d.id=?1 or ?1 is null) order by order asc")
	public List<Department> findByDepartment(String department);

	@Query("from Department d where (d.id=?1 or ?1 is null) and (?2 is null or d.status = ?2) and (?3 is null or d.isStuDep = ?3) order by order asc")
	public List<Department> findByStatusAndType(String department, Integer status, Integer type);
}
